package cn.itcast.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
/*
设置值
 */
public class JDBC_Demo1 {
    public static void main(String[] args) throws Exception {
        //1. 注册驱动
        Class.forName("com.mysql.jdbc.Driver");
        //2. 获取数据库连接对象
        Connection cnn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test");

        //3. 定义sql语句
        String sql = "update dept set loc = \"12344\" where deptno = 10";
        //4. 获取执行sql的对象
        Statement statement = cnn.createStatement();
        //5. 执行sql
        int result = statement.executeUpdate(sql);
        //6. 处理结果
        System.out.println(result);
        //7. 释放资源
        cnn.close();
        statement.close();
    }
}
